import java.util.HashMap;

/*
 * @lc app=leetcode.cn id=12 lang=java
 *
 * [12] 整数转罗马数字
 */

// @lc code=start
class Solution {
    //这个也应该放在简单里，也是阅读理解。
    public String intToRoman(int num) {
        int[] value = new int[]{1000,900,500,400,100,90,50,40,10,9,5,4,1};
        String[] str = new String[]{"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
        String res = "";
        for(int i =0 ;num!=0;i++){
            while(num>=value[i]){
                num-=value[i];
                res+=str[i];
            }
        }
        return res;
    }
}
// @lc code=end

